Optimal. Leaf size=56 \[ -\frac {a (A+2 B) x}{c}+\frac {a B \cos (e+f x)}{c f}+\frac {2 a (A+B) \cos (e+f x)}{f (c-c \sin (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 56, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {3046, 2936,
2718} \begin {gather*} \frac {2 a (A+B) \cos (e+f x)}{f (c-c \sin (e+f x))}-\frac {a x (A+2 B)}{c}+\frac {a B \cos (e+f x)}{c f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2718
Rule 2936
Rule 3046
Rubi steps
\begin {align*} \int \frac {(a+a \sin (e+f x)) (A+B \sin (e+f x))}{c-c \sin (e+f x)} \, dx &=(a c) \int \frac {\cos ^2(e+f x) (A+B \sin (e+f x))}{(c-c \sin (e+f x))^2} \, dx\\ &=\frac {2 a (A+B) \cos (e+f x)}{f (c-c \sin (e+f x))}+\frac {a \int (-A c-2 B c-B c \sin (e+f x)) \, dx}{c^2}\\ &=-\frac {a (A+2 B) x}{c}+\frac {2 a (A+B) \cos (e+f x)}{f (c-c \sin (e+f x))}-\frac {(a B) \int \sin (e+f x) \, dx}{c}\\ &=-\frac {a (A+2 B) x}{c}+\frac {a B \cos (e+f x)}{c f}+\frac {2 a (A+B) \cos (e+f x)}{f (c-c \sin (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(125\) vs. \(2(56)=112\).
time = 0.63, size = 125, normalized size = 2.23 \begin {gather*} \frac {a \left (-((A+2 B) x)+\frac {B \cos (e) \cos (f x)}{f}-\frac {B \sin (e) \sin (f x)}{f}+\frac {4 (A+B) \sin \left (\frac {f x}{2}\right )}{f \left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )}\right ) (1+\sin (e+f x))}{c \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.23, size = 67, normalized size = 1.20
method | result | size |
derivativedivides | \(\frac {2 a \left (\frac {B}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}-\left (A +2 B \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {2 A +2 B}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1}\right )}{f c}\) | \(67\) |
default | \(\frac {2 a \left (\frac {B}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}-\left (A +2 B \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {2 A +2 B}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1}\right )}{f c}\) | \(67\) |
risch | \(-\frac {a x A}{c}-\frac {2 a x B}{c}+\frac {B a \,{\mathrm e}^{i \left (f x +e \right )}}{2 c f}+\frac {B a \,{\mathrm e}^{-i \left (f x +e \right )}}{2 c f}+\frac {4 a A}{f c \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}+\frac {4 a B}{f c \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}\) | \(104\) |
norman | \(\frac {\frac {a \left (A +2 B \right ) x}{c}+\frac {a \left (A +2 B \right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c}-\frac {4 a A +4 a B}{c f}-\frac {2 a B \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c f}-\frac {2 a B \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c f}-\frac {\left (4 a A +2 a B \right ) \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c f}-\frac {2 \left (4 a A +3 a B \right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c f}-\frac {a \left (A +2 B \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{c}+\frac {2 a \left (A +2 B \right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c}-\frac {2 a \left (A +2 B \right ) x \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c}-\frac {a \left (A +2 B \right ) x \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2} \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}\) | \(269\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 287 vs.
\(2 (60) = 120\).
time = 0.53, size = 287, normalized size = 5.12 \begin {gather*} -\frac {2 \, {\left (B a {\left (\frac {\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} - \frac {\sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} - 2}{c - \frac {c \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {c \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} - \frac {c \sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}} + \frac {\arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{c}\right )} + A a {\left (\frac {\arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{c} - \frac {1}{c - \frac {c \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}}\right )} + B a {\left (\frac {\arctan \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}\right )}{c} - \frac {1}{c - \frac {c \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}}\right )} - \frac {A a}{c - \frac {c \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1}}\right )}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 122 vs.
\(2 (60) = 120\).
time = 0.39, size = 122, normalized size = 2.18 \begin {gather*} -\frac {{\left (A + 2 \, B\right )} a f x - B a \cos \left (f x + e\right )^{2} - 2 \, {\left (A + B\right )} a + {\left ({\left (A + 2 \, B\right )} a f x - {\left (2 \, A + 3 \, B\right )} a\right )} \cos \left (f x + e\right ) - {\left ({\left (A + 2 \, B\right )} a f x - B a \cos \left (f x + e\right ) + 2 \, {\left (A + B\right )} a\right )} \sin \left (f x + e\right )}{c f \cos \left (f x + e\right ) - c f \sin \left (f x + e\right ) + c f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 828 vs.
\(2 (48) = 96\).
time = 1.21, size = 828, normalized size = 14.79 \begin {gather*} \begin {cases} - \frac {A a f x \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} + \frac {A a f x \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} - \frac {A a f x \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} + \frac {A a f x}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} - \frac {4 A a \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} - \frac {4 A a}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} - \frac {2 B a f x \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} + \frac {2 B a f x \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} - \frac {2 B a f x \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} + \frac {2 B a f x}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} - \frac {4 B a \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} + \frac {2 B a \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )}}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} - \frac {6 B a}{c f \tan ^{3}{\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f \tan ^{2}{\left (\frac {e}{2} + \frac {f x}{2} \right )} + c f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - c f} & \text {for}\: f \neq 0 \\\frac {x \left (A + B \sin {\left (e \right )}\right ) \left (a \sin {\left (e \right )} + a\right )}{- c \sin {\left (e \right )} + c} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 124 vs.
\(2 (60) = 120\).
time = 0.41, size = 124, normalized size = 2.21 \begin {gather*} -\frac {\frac {{\left (A a + 2 \, B a\right )} {\left (f x + e\right )}}{c} + \frac {2 \, {\left (2 \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 \, B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 2 \, A a + 3 \, B a\right )}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )} c}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.64, size = 111, normalized size = 1.98 \begin {gather*} \frac {\left (4\,A\,a+4\,B\,a\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-2\,B\,a\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )+4\,A\,a+6\,B\,a}{f\,\left (-c\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3+c\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-c\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )+c\right )}-\frac {A\,a\,f\,x+2\,B\,a\,f\,x}{c\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________